﻿using Tables;
using System;
using System.Diagnostics;

namespace calculator
{
    class FunctionTable
    {
        public FunctionTable(SymbolTable symtab/*, FunctionEntry[] funcArray*/)
        {
            _size = 0;
            for (int i = 0;
                i < _maxArray;
                ++i)
            {
                int len = funcArr[i].FuncName.Length;
                Console.WriteLine(funcArr[i].FuncName);
                int j = symtab.ForceAdd(funcArr[i].FuncName, len);
                Debug.Assert(i == j);
                ++_size;
            }
        }
        public int Size()
        {
            return _size;
        }
        public FunctionEntry GetFunction(int id)
        {
            return funcArr[id];
        }
        
            //FunctionEntry.Function(3, Math.Sin);
            //FunctionEntry funcEntry = new FunctionEntry(Math.Sin, "sin");
           



            private int _size;
            private const int _maxArray = 13;
            private FunctionEntry[] funcArr = new FunctionEntry[_maxArray]
            {
               new FunctionEntry( Math.Log, "log"),
               new FunctionEntry (Math.Log10 , "log10"),
               new FunctionEntry (Math.Exp , "exp"),
               new FunctionEntry (Math.Sqrt , "sqrt"),
               new FunctionEntry (Math.Sin , "sin"),
               new FunctionEntry (Math.Cos , "cos"),
               new FunctionEntry (Math.Tan , "tan"),
               new FunctionEntry (Math.Sinh , "sinh"),
               new FunctionEntry (Math.Cosh , "cosh"),
               new FunctionEntry (Math.Tanh , "tanh"),
               new FunctionEntry (Math.Asin , "asin"),
               new FunctionEntry (Math.Acos , "acos"),
               new FunctionEntry (Math.Atan , "atan")
            };
    }
}
